<template>
  <div>
    <el-tree :data="permissionData" :props="{label:'name',children:'children'}" />
    <el-row justify="end" type="flex">
      <el-button size="small" type="success">
        确定
      </el-button>
      <el-button size="small" type="info">
        删除
      </el-button>
    </el-row>
  </div>
</template>
<script>
import { getPermissionList } from '@/api/permisson'
import { transDataToTreeData } from '@/utils/index'
export default {
  data() {
    return {
      permissionData: [] // 存储权限数据
    }
  },
  created() {
    this.loadgetPermissionList()
  },

  methods: {
    async loadgetPermissionList() {
      try {
        const res = await getPermissionList()
        console.log('res', res)
        this.permissionData = transDataToTreeData(res.data)
        console.log(' this.permissionData', this.permissionData)
      } catch (error) {
        console.log(error)
      }
    }
  }
}
</script>
